//
//  RecommendVM.m
//  YuDou
//
//  Created by qiupeng on 2018/6/23.
//  Copyright © 2018年 yingqi. All rights reserved.
//

#import "RecommendVM.h"
#import "CycleModel.h"
#import "AnchorGroup.h"
#import "AnchorModel.h"

@interface RecommendVM()
 
@end

@implementation RecommendVM

// Banner
+ (void)requestCycleData:(void (^)(id))cycleData
{
    [self loadAnchorDataWithUrl:@"http://capi.douyucdn.cn/api/v1/slide/6" parameters:@{@"version":@"2.401"} success:^(id JSON) {
        NSArray *array = [CycleModel mj_objectArrayWithKeyValuesArray:JSON[@"data"]];
        cycleData(array);
    }];

}

+ (void)getAnchorGroups:(void (^)(id))anchorGroups
{
    NSDictionary *parameters = @{@"limit" : @"4",
                                 @"offset" : @"0",
                                 @"client_sys" : @"ios",
                                 @"time" : [NSDate getcurrentTime]};
    [self loadAnchorData:@"http://capi.douyucdn.cn/api/v1/getHotCate" parameters:parameters success:^(NSArray *JSON) {
        anchorGroups(JSON);
    }];
}

// 颜值
+ (void)getPrettyGroup:(void (^)(id))anchorGroups
{
    NSDictionary *parameters = @{@"limit" : @"4",
                                 @"offset" : @"0",
                                 @"client_sys" : @"ios",
                                 @"time" : [NSDate getcurrentTime]};
    [self loadAnchorDataWithUrl:@"http://capi.douyucdn.cn/api/v1/getVerticalRoom" parameters:parameters success:^(id JSON) {
        NSArray *array = [AnchorModel mj_objectArrayWithKeyValuesArray:JSON[@"data"]];
        anchorGroups(array);
    }];
}

// 最热
+ (void)getHottestGroup:(void (^)(id))anchorGroups
{
    NSDictionary *parameters = @{ @"client_sys" : @"ios",
                                 @"time" : [NSDate getcurrentTime]};
    [self loadAnchorDataWithUrl:@"http://capi.douyucdn.cn/api/v1/getbigDataRoom" parameters:parameters success:^(id JSON) {
        NSArray *array = [AnchorModel mj_objectArrayWithKeyValuesArray:JSON[@"data"]];
        anchorGroups(array);
    }];
}

@end
